<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <div id="app">
      姓: <input type="text" v-model="firstName" /> <br />
      名: <input type="text" v-model="lastName" /> <br />
      <p>姓名: {{ fullName }}</p>
    </div>
    <script src="./js/vue.js"></script>
    <script>
      const vm = new Vue({
        data: {
          firstName: "",
          lastName: "",
          fullName: "",
        },
        watch: {
          firstName(firstName) {
            this.fullName = firstName + " " + this.lastName;
          },
          lastName(lastName) {
            this.fullName = this.firstName + " " + lastName;
          },
        },
      });
      vm.$mount("#app");
    </script>
  </body>
</html>
